package com.wf.demo.job.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.metadata.BaseRowModel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.wf.demo.info.pojo.Device;
import lombok.Data;
import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@Table(name = "data")
@JsonIgnoreProperties({ "handler","hibernateLazyInitializer" })
public class DataDevice {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ExcelProperty(value = "id", index = 0)
    private Long id;

    @ManyToOne
    @JoinColumn(name = "did")

    @ExcelIgnore
    private Device device;

    @ExcelProperty(value = "经度", index = 1)
    private BigDecimal longitude;
    @ExcelProperty(value = "纬度", index = 2)
    private BigDecimal latitude;
    @ExcelProperty(value = "转速", index = 3)
    private BigDecimal speed;
    @ExcelProperty(value = "运行状态", index = 4)
    private String status;
    @ExcelProperty(value = "滑油压力", index = 5)
    private BigDecimal greasePressure;
    @ExcelProperty(value = "水温", index = 6)
    private BigDecimal waterTemp;
    @ExcelProperty(value = "故障码", index = 7)
    private String alarmCode;

    @ExcelProperty(value = "创建时间", index = 8,converter=LocalDateTimeConverter.class)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**---------扩展数据--------*/
    @ExcelProperty(value = "扩展数据1", index = 9)
    private  BigDecimal data1;

    @ExcelProperty(value = "扩展数据2", index = 10)
    private  BigDecimal data2;

    @ExcelProperty(value = "扩展数据3", index = 11)
    private  BigDecimal data3;

    @ExcelProperty(value = "扩展数据4", index = 12)
    private  BigDecimal data4;

    @ExcelProperty(value = "扩展数据5", index = 13)
    private  BigDecimal data5;

    @ExcelProperty(value = "扩展数据6", index = 14)
    private  BigDecimal data6;

    @ExcelProperty(value = "扩展数据1=7", index = 15)
    private  BigDecimal data7;

}
